<?php

/**
 * This is the model class for table "jumlahsapiperah".
 *
 * The followings are the available columns in table 'jumlahsapiperah':
 * @property integer $jsp_id
 * @property integer $jsp_kec
 * @property integer $jsp_peternak
 * @property integer $jsp_dewasa_jantan
 * @property integer $jsp_dewasa_betina
 * @property integer $jsp_muda_jantan
 * @property integer $jsp_muda_betina
 * @property integer $jsp_anak_jantan
 * @property integer $jsp_anak_betina
 * @property integer $jsp_produksi_jumlah
 * @property integer $jsp_produksi_nilai
 * @property integer $jsp_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jspKec
 */
class Jumlahsapiperah extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahsapiperah the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahsapiperah';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jsp_kec, jsp_peternak, jsp_dewasa_jantan, jsp_dewasa_betina, jsp_muda_jantan, jsp_muda_betina, jsp_anak_jantan, jsp_anak_betina, jsp_produksi_jumlah, jsp_produksi_nilai, jsp_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jsp_id, jsp_kec, jsp_peternak, jsp_dewasa_jantan, jsp_dewasa_betina, jsp_muda_jantan, jsp_muda_betina, jsp_anak_jantan, jsp_anak_betina, jsp_produksi_jumlah, jsp_produksi_nilai, jsp_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jspKec' => array(self::BELONGS_TO, 'Kecamatan', 'jsp_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jsp_id' => 'Jsp',
			'jsp_kec' => 'Jsp Kec',
			'jsp_peternak' => 'Jumlah Peternak',
			'jsp_dewasa_jantan' => 'Sapi Dewasa Jantan',
			'jsp_dewasa_betina' => 'Sapi Dewasa Betina',
			'jsp_muda_jantan' => 'Sapi Muda Jantan',
			'jsp_muda_betina' => 'Sapi Muda Betina',
			'jsp_anak_jantan' => 'Sapi Anak Jantan',
			'jsp_anak_betina' => 'Sapi Anak Betina',
			'jsp_produksi_jumlah' => 'Jumlah Produksi',
			'jsp_produksi_nilai' => 'Nilai Produksi',
			'jsp_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jsp_id',$this->jsp_id);
		$criteria->compare('jsp_kec',$this->jsp_kec);
		$criteria->compare('jsp_peternak',$this->jsp_peternak);
		$criteria->compare('jsp_dewasa_jantan',$this->jsp_dewasa_jantan);
		$criteria->compare('jsp_dewasa_betina',$this->jsp_dewasa_betina);
		$criteria->compare('jsp_muda_jantan',$this->jsp_muda_jantan);
		$criteria->compare('jsp_muda_betina',$this->jsp_muda_betina);
		$criteria->compare('jsp_anak_jantan',$this->jsp_anak_jantan);
		$criteria->compare('jsp_anak_betina',$this->jsp_anak_betina);
		$criteria->compare('jsp_produksi_jumlah',$this->jsp_produksi_jumlah);
		$criteria->compare('jsp_produksi_nilai',$this->jsp_produksi_nilai);
		$criteria->compare('jsp_tahun',$this->jsp_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}